﻿CREATE PROCEDURE [dbo].[Semester_Select]
	@ID INT = NULL,
	@DisplayName NVARCHAR(50) = NULL,
	@StartDate DATETIME = NULL,
	@EndDate DATETIME =NULL

	AS

	SELECT * 
	FROM [Semester]
	WHERE 

	(
	   ( @ID IS NULL OR ID = @ID) AND
	   ( @DisplayName IS NULL OR DisplayName LIKE @DisplayName + '%') AND
	   ( @StartDate IS NULL OR cast([StartDate] as date) = cast(@StartDate as date) ) AND 
	   ( @EndDate IS NULL OR cast([EndDate] as date) = cast(@EndDate as date) ) 
	)
	
